//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __KTIME_H_
#define __KTIME_H_

typedef struct timeval_o {
    long    tv_sec;         /* seconds */
    long    tv_usec;        /* and microseconds */
} timeval_o;

typedef struct timespec_o {
    long    tv_sec;         /* seconds */
    long    tv_nsec;        /* and nanoseconds */
} timespec_o;

typedef struct timezone {
    int    tz_minuteswest;  /* minutes west of Greenwich */
    int    tz_dsttime;      /* type of dst correction */
} timezone;

#define    TIMEVAL_TO_TIMESPEC(tv, ts)         \
    do {                                       \
        (ts)->tv_sec = (tv)->tv_sec;           \
        (ts)->tv_nsec = (tv)->tv_usec * 1000;  \
    } while (0)

EXTERN_C Void unix2dostime(timespec_o *tsp, UInt16 *ddp, UInt16 *dtp, UInt8 *dhp);
EXTERN_C Void dos2unixtime(UInt32 dd, UInt32 dt, UInt32 dh, timespec_o *tsp);

#endif // __KTIME_H_
